# 代码编辑调试

直接在源码里编辑，实时效果

```jsx live=true  codeDefaultShow=true
class Counter extends React.Component {
  constructor() {
    super();
    this.state = { count: 0 };
  }

  componentDidMount() {
    this.interval = setInterval(() => {
      this.setState((state) => ({ count: state.count + 1 }));
    }, 1000);
  }

  componentWillUnmount() {
    clearInterval(this.interval);
  }

  render() {
    return <Button>{this.state.count}</Button>;
  }
}
```
